# if vs while
# spam = 0
# if spam < 5:
#     print('ok')
#     spam=spam+1
# print(spam)
    
# spam = 0
# while spam < 5:
#     print('wait')
#     spam=spam+1
# print(spam)

#一个循环
# name = ''
# while name !='your name':
#     print('please type your name')
#     name = input()
# print('thank you')

#break + while循环
# while True:
#     print('Please type your name')
#     name = input()
#     if name =='your name':
#         break
# print('Thank you')

#continue语句
# while True:
#     print('Who are you?')
#     name = input()
#     if name != 'joe':
#         continue
#     print('hello,joe.what is the password?')
#     password = input()
#     if password =='fish':
#         break
# print('Acess granted')


#类真与类假的值————用于条件时，0、0.0、空字符串等同于False，其他值等同于True
# name = ''
# while not name:
#     print('Enter your name:')
#     name = input()
# print('How many guests will you have?')
# num0fGuests = int(input())
# if num0fGuests:
#     print('Be sure to have enough room for all your guests')
# print('Done')

#----------for循环和range()函数----------
# sum = 0
# for i in range(1,101,1):
#     sum = sum + i
# print(sum)

#-----------导入模块------------
# import random
# import sys
# for i in range(5):
#     print(random.randint(1,10))

# while True:
#     print('Type exit to exit')
#     response = input()
#     if response == 'exit':
#         sys.exit()
#     print('You typed' + response + '.')



#---------------小程序：猜数字----------
#-----------my version
# print('I am thinking of a number between 1 and 20.')
# answer = int(input())
# while True:
#     print('Take a guess')
#     num = int(input())
#     if num < answer:
#         print('your guess is too low')
#     elif num > answer:
#         print('your guess is too high')
#     elif num == answer:
#         break
# print('Good job!You guessed my number')

#---------Example
# import random
# secretNumber = random.randint(1,20)
# print('I am thinking of a number between 1 and 20.')

# for guessesTaken in range(1,3):
#     print('Take a guess.')
#     guess = int(input())
#     if guess < secretNumber:
#         print('your guess is too low')
#     elif guess > secretNumber:
#         print('your guess is too high')
#     else:
#         break
# if guess == secretNumber:
#     print('Good job!You guessed my number in '+ str(guessesTaken) + ' guesses!')
# else:
#     print('you are unlucky')

#--------------------小程序：石头、剪刀、布
import random,sys

print("ROCK,PAPER,SCISSORS")
#先定义计数变量
Wins = 0
Losses = 0
Ties = 0
#循坏
while True:
    print('%s Wins,%s Losses,%s Ties' % (Wins,Losses,Ties))
    while True:
        print('Enter your move:(r)ock (p)aper (s)cissors or (q)uit')
        playermove = input()
        if playermove == 'q':
            sys.exit()
        elif playermove == 'r' or playermove =='p' or playermove =='s':
            break
        print('Type one of r,p,s,q')

    if playermove == 'r':
        print('ROCK versus...')
    elif playermove == 'p':
        print('PAPER versus...')
    elif playermove == 's':
        print('SCISSORS versus...')

    #电脑产生的结果
    randnumber = random.randint(1,3)
    if randnumber == 1:
        computermove ='r'
        print('ROCK')
    elif randnumber == 2:
        computermove ='p'
        print('PAPER')
    elif randnumber == 3:
        computermove ='s'
        print('SCISSORS')

    #比较结果
    if playermove == computermove:
        print('It is a tie')
        Ties = Ties + 1
    elif playermove =='r' and computermove == 's':
        print('You win!')
        Wins = Wins + 1
    elif playermove =='s' and computermove == 'p':
        print('You win!')
        Wins = Wins + 1
    elif playermove =='p' and computermove == 'r':
        print('You win!')
        Wins = Wins + 1
    elif playermove =='r' and computermove == 'p':
        print('You lose!')
        Losses = Losses + 1
    elif playermove =='s' and computermove == 'r':
        print('You lose!')
        Losses = Losses + 1
    elif playermove =='p' and computermove == 's':
        print('You lose!')
        Losses = Losses + 1









   

    